<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('天亮云课堂课程管理列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>

                            <li>
                                <label>课程标题：</label>
                                <input type="text" name="courseTitle"/>
                            </li>

                            <li>
                                <!-- TODO：专题-->
                                <label>专题名称：</label>
                                <input type="text" name="courseName"/>
                            </li>

                            <!--<li>
                                <label>课程难度：</label>
                                <select name="courseDegree">
                                    <option value="">所有</option>
                                    <option value="-1">代码生成请选择字典属性</option>
                                </select>
                            </li>
                            <li>
                                <label>商品价格：</label>
                                <select name="goodsPrice" th:with="type=${@dict.getType('course_price')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>商品原价：</label>
                                <input type="text" name="commodityPrice"/>
                            </li>
                            <li>
                                <label>折后价：</label>
                                <input type="text" name="afterDiscountPrice"/>
                            </li>
                            <li>
                                <label>课程排序：</label>
                                <input type="text" name="courseSort"/>
                            </li>
                            <li>
                                <label>是否轮播：</label>
                                <select name="isShuffl" th:with="type=${@dict.getType('sys_yes_no')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>是否精品推荐：</label>
                                <select name="isRecommend" th:with="type=${@dict.getType('sys_yes_no')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>是否免费：</label>
                                <select name="isFree" th:with="type=${@dict.getType('sys_yes_no')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>是否对外：</label>
                                <select name="isOut" th:with="type=${@dict.getType('sys_yes_no')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>是否展示详情：</label>
                                <select name="isShowDetails" th:with="type=${@dict.getType('sys_yes_no')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>课程播放量：</label>
                                <input type="text" name="coursePlay"/>
                            </li>
                            <li>
                                <label>课程状态：</label>
                                <select name="courseState" th:with="type=${@dict.getType('online_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>-->
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="course:course:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="course:course:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="course:course:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="course:course:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">



        var editFlag = [[${@permission.hasPermi('course:course:edit')}]];
        var removeFlag = [[${@permission.hasPermi('course:course:remove')}]];
        var courseCategoryDatas = [[${@dict.getType('course_category')}]];
        var goodsPriceDatas = [[${@dict.getType('course_price')}]];
        var isShufflDatas = [[${@dict.getType('sys_yes_no')}]];
        var isRecommendDatas = [[${@dict.getType('sys_yes_no')}]];
        var isFreeDatas = [[${@dict.getType('sys_yes_no')}]];
        // var isFreeDatas = [[${@dict.getType('whether_free')}]];
        var isOutDatas = [[${@dict.getType('sys_yes_no')}]];
        var isShowDetailsDatas = [[${@dict.getType('sys_yes_no')}]];
        var courseStateDatas = [[${@dict.getType('online_status')}]];
        var prefix = ctx + "course/course";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "天亮云课堂课程管理",
                columns: [{
                    checkbox: true
                },

                    /*多余展示字段*/

                    {
                    field: 'courseId',
                    title: '课程ID',
                    visible: false
                },
                /*{
                    field: 'courseCategory',
                    title: '课程分类',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabels(courseCategoryDatas, value);
                    }
                },
                {
                    field: 'courseName',
                    title: '课程名称'
                },*/

                    /*多余展示字段*/


                    {
                    field: 'courseTitle',
                    title: '课程标题'
                },

                    {
                        field: 'isOut',
                        title: '是否对外',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(isOutDatas, value);
                        }
                    },

                    {
                        field: 'isFree',
                        title: '是否免费',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(isFreeDatas, value);
                        }
                    },

                    {
                        field: 'goodsPrice',
                        title: '是否打折',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(goodsPriceDatas, value);
                        }
                    },

                    {
                        field: 'commodityPrice',
                        title: '课程价格'
                    },
                    {
                        field: 'afterDiscountPrice',
                        title: '折后价'
                    },
                    {
                        field: 'discountDesc',
                        title: '降价描述'
                    },

                    /*多余展示字段*/


                     /*{
                         field: 'courseDesc',
                         title: '课程简介'
                     },
                     {
                         field: 'courseDegree',
                         title: '课程难度'
                     },


                     {
                         field: 'courseSort',
                         title: '课程排序'
                     },
                     {
                         field: 'isShuffl',
                         title: '是否轮播',
                         formatter: function(value, row, index) {
                            return $.table.selectDictLabel(isShufflDatas, value);
                         }
                     },
                     {
                         field: 'isRecommend',
                         title: '是否精品推荐',
                         formatter: function(value, row, index) {
                            return $.table.selectDictLabel(isRecommendDatas, value);
                         }
                     },


                     {
                         field: 'courseCover',
                         title: '课程封面'
                     },
                     {
                         field: 'courseShuffl',
                         title: '课程轮播图'
                     },
                     {
                         field: 'coursePcShuffl',
                         title: '课程PC轮播图'
                     },
                     {
                         field: 'isShowDetails',
                         title: '是否展示详情',
                         formatter: function(value, row, index) {
                            return $.table.selectDictLabel(isShowDetailsDatas, value);
                         }
                     },
                     {
                         field: 'courseDetails',
                         title: '课程详情介绍'
                     },
                     {
                         field: 'coursePlay',
                         title: '课程播放量'
                     },
                     {
                         field: 'courseState',
                         title: '课程状态',
                         formatter: function(value, row, index) {
                            return $.table.selectDictLabel(courseStateDatas, value);
                         }
                     },
                     {
                         field: 'courseRemark',
                         title: '课程备注'
                     },*/

                    /*多余展示字段*/


                    {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.courseId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        // TODO：章节
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.courseId + '\')"><i class=""></i>章节</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.courseId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>